/**
 * Created by ACER on 2017/4/4.
 */
var net="http://www.xiaowenxiong.cn";
app.controller('tel-register', function ($scope, $http) {
    //用户电话号码
    $scope.telnumber = '';
    //用户登录密码
    $scope.password = '';
    $scope.telRegister = function(){
        var registerInfo = {'telnumber':$scope.telnumber,'password':$scope.password};
        $http({
            method:'post',
            //url:'http://www.xiaowenxiong.cn/users/register/tel',
            url:app.netPath+'/users/register/tel',
            params:registerInfo
        }).then(function(res){

            if(!res.data.error){
                $.alert('注册成功',function(){
                    location.href='#login';
                });
            }else{
                var errorCode=res.data.error;
                switch (errorCode){
                    case  101:
                        $.alert('请输入用户名和密码和验证码');
                        return ;
                    case 102:
                        $.alert('该用户已被注册');
                        return ;
                    case 200:
                        $.alert('注册失败，请重试');
                        return ;
                    case 108:
                        $.alert('重新获取验证码');
                        return ;
                    case  109:
                        $.alert('验证码错误');
                        return ;

                }
            }
        },function(res){
            $.alert('网络或设置问题');
        })
    }
});